package com.jl.jlapp.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jl.jlapp.R;
import com.jl.jlapp.eneity.AdvertisementByIdModel;
import com.jl.jlapp.eneity.GoodsListModel;

import java.util.List;

public class GoodsListAdapter3 extends BaseQuickAdapter<GoodsListModel.ResultDataBean, BaseViewHolder> {

    public GoodsListAdapter3(@Nullable List<GoodsListModel.ResultDataBean> data) {
        super(R.layout.goods_list_item3, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, GoodsListModel.ResultDataBean item) {
        TextView oldPrice = helper.getView(R.id.old_goods_price);
        oldPrice.getPaint().setFlags(16);
        helper.setText(R.id.goods_name, item.getName())
                .setText(R.id.goods_price, item.getGoodsSpecificationDetails().get(0).getPrice() + "");
        if (item.getGoodsSpecificationDetails().get(0).getOldPrice() > 0.0D) {
            oldPrice.setVisibility(View.VISIBLE);
            oldPrice.setText("¥" + (item.getGoodsSpecificationDetails().get(0)).getOldPrice());
        }
        ImageView localImageView;
        localImageView = helper.getView(R.id.goods_img);
        if (item.getGoodsSpecificationDetails().get(0).getGoodsDisplayPictures().size() <= 0) {
            oldPrice.setVisibility(View.GONE);
            Glide.with(mContext).asBitmap().apply(new RequestOptions().placeholder(R.drawable.img_noimg_m).error(R.drawable.img_noimg_m)).load(Integer.valueOf(R.drawable.img_noimg_m)).into(localImageView);
        } else {
            String picUrl = item.getGoodsSpecificationDetails().get(0).getGoodsDisplayPictures().get(0).getPicUrl();
            Glide.with(mContext).asBitmap().apply(new RequestOptions().placeholder(R.drawable.img_noimg_m).error(R.drawable.img_noimg_m)).load("http://117.158.178.202:8001/JLMIS/" + picUrl).into(localImageView);
        }
    }
}
//
//
///* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/adapter/GoodsListAdapter3.class
// * Java compiler version: 6 (50.0)
// * JD-Core Version:       0.7.1
// */